package cn.itcalvin.sncoal.cth.controller;

import cn.hutool.core.io.FileUtil;
import cn.hutool.http.HttpUtil;
import cn.itcalvin.sncoal.cth.aspect.LogAnnotation;
import cn.itcalvin.sncoal.cth.aspect.NotAuthAnnotation;
import cn.itcalvin.sncoal.cth.aspect.RoleAnnotation;
import cn.itcalvin.sncoal.cth.config.CthConfig;
import cn.itcalvin.sncoal.cth.pojo.common.ReqLong;
import cn.itcalvin.sncoal.cth.pojo.common.RespUserInfo;
import cn.itcalvin.sncoal.cth.service.InfoPfService;
import cn.itcalvin.sncoal.cth.utils.JwtUtil;
import com.spire.doc.Document;
import com.spire.doc.FileFormat;
import com.spire.doc.documents.XHTMLValidationType;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import javax.websocket.server.PathParam;
import java.io.*;

@Api(tags = "报告导出和查看")
@Controller
@RequestMapping("/api/report")
public class WordController {

    @Resource
    InfoPfService infoPfService;

    @ApiOperation(value = "导出某任务各系统得分情况")
    @LogAnnotation(value = "导出某任务各系统得分情况",logType = 3)
    @GetMapping("exportPfById")
    @NotAuthAnnotation
    public void exportPfById(@PathParam("id") Long id,@PathParam("token") String token, HttpServletResponse response) throws IOException {
        if(!JwtUtil.verify(token)){
            return;
        }
        infoPfService.exportPfById(id,response);
    }

}
